package com.project_test.kun.travelling_1st.Discovery.discover_detail_beans;

import android.util.Log;

import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;

import java.util.ArrayList;
import java.util.List;

/**
 * Created by asus on 2016/10/17 09 49.
 * 邮箱:763433963@qq.com
 */




/*
*
        "id": "713",
        "tid": "218",
        "create_time": "1470374605",
        "last_update": "1470378213",
        "t_sort": "0",
        "t_status": "1",
        "tag_title": "轰趴馆的狂浪之旅",


* */
public class discover_detail_item_bean {
    private String id;
    private String title;
    private String sub_title;
    private String addr;
    private String tel;
    private String head_pic;
    private String t_sort;
    private String create_time;
    private String t_status;
    private String start_time;
    private String end_time;
    private String t_type;
    private String goods_id;
    private String mall_title;
    private String admin_id;
    private String views;
    private discover_detail_size_pic_bean size_pic;
    private List<discover_detail_good_bean> goods;
    private List<discover_detail_detail_bean> details;

    public void parseJson(JSONObject json) throws JSONException {

        if (json != null) {
            title = json.optString("title");
            id = json.optString("id");
            sub_title = json.optString("sub_title");
            addr = json.optString("addr");
            tel = json.optString("tel");
            head_pic = json.optString("head_pic");
            t_sort = json.optString("t_sort");
            create_time = json.optString("create_time");
            t_status = json.optString("t_status");
            start_time = json.optString("start_time");
            end_time = json.optString("end_time");
            t_type = json.optString("t_type");
            goods_id = json.optString("goods_id");
            mall_title = json.optString("mall_title");
            admin_id = json.optString("admin_id");
            views = json.optString("views");

            JSONObject obj1 = json.getJSONObject("size_pic");
            discover_detail_size_pic_bean size_pic = new discover_detail_size_pic_bean();
            size_pic.parseJson(obj1);

            details = new ArrayList<>();
            JSONArray list1 = json.getJSONArray("details");
            int len1 = list1.length();
            for (int i = 0; i < len1; i++) {
                JSONObject jsonObject = list1.getJSONObject(i);
                discover_detail_detail_bean item = new discover_detail_detail_bean();
                item.parseJson(jsonObject);
                details.add(item);
            }

            goods = new ArrayList<>();
            JSONArray list2 = json.getJSONArray("goods");
            int len2 = list2.length();
            for (int i = 0; i < len2; i++) {
                JSONObject jsonObject = list2.getJSONObject(i);
                discover_detail_good_bean item = new discover_detail_good_bean();
                item.parseJson(jsonObject);
                goods.add(item);
            }

        }

    }

    public String getId() {
        return id;
    }

    public String getTitle() {
        return title;
    }

    public String getSub_title() {
        return sub_title;
    }

    public String getAddr() {
        return addr;
    }

    public String getTel() {
        return tel;
    }

    public String getHead_pic() {
        return head_pic;
    }

    public String getT_sort() {
        return t_sort;
    }

    public String getCreate_time() {
        return create_time;
    }

    public String getT_status() {
        return t_status;
    }

    public String getStart_time() {
        return start_time;
    }

    public String getEnd_time() {
        return end_time;
    }

    public String getT_type() {
        return t_type;
    }

    public String getGoods_id() {
        return goods_id;
    }

    public String getMall_title() {
        return mall_title;
    }

    public String getAdmin_id() {
        return admin_id;
    }

    public String getViews() {
        return views;
    }

    public discover_detail_size_pic_bean getSize_pic() {
        return size_pic;
    }

    public List<discover_detail_good_bean> getGoods() {
        return goods;
    }

    public List<discover_detail_detail_bean> getDetails() {
        return details;
    }


}
